|
In the Java programming language, the final keyword is used in several different contexts to define an entity which may only be assigned once.Once a final variable has been assigned, it always contains the same value. If a final variable holds a reference to an object, then the state of the object may be changed by operations on the object, but the variable will always refer to the same object. This applies also to arrays, because arrays are objects; if a final variable holds a reference to an array, then the components of the array may be changed by operations on the array, but the variable will always refer to the same array.〔Java Language Specification #4.12.4〕==Final classes== A final class cannot be subclassed. Doing this can confer security and efficiency benefits, so many of the Java standard library classes are final, such as and . All methods in a final class are implicitly final. Example: Restricted subclasses are often referred to as "soft final" classes. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Final (Java)」の詳細全文を読む スポンサード リンク
|